package com.wisezone.home01;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        //创建输入对象
        Scanner scanner =new Scanner(System.in);
        FileOutputStream fileOutputStream=null;
        try {
            fileOutputStream=new FileOutputStream("log.txt");
            System.out.println("请输入字符串：");
            String str=scanner.next();
            while(!"exit".equals(str)){
                fileOutputStream.write(str.getBytes());
                fileOutputStream.flush();
                System.out.println("请输入字符串：");
                str=scanner.next();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }catch (IOException e){
            e.printStackTrace();
        }



    }
}
